<?php
declare(strict_types=1);

namespace App\Controller\WebApi\Common;

use App\Controller\AbstractController;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\HttpServer\Annotation\Controller;
use App\Middleware\WebApiMiddleware;
use Hyperf\HttpServer\Annotation\Middleware;
use Service\Code\VerifyImgService;
use Hyperf\Di\Annotation\Inject;

/**
 * 图形验证码
 * @author chenshubo
 * @Controller(prefix="/webapi/common/graph")
 * @Middleware(WebApiMiddleware::class)
 */
class GraphController extends AbstractController
{
    /**
     * @Inject()
     * @var VerifyImgService
     */
    protected $verifyImgService;
    /**
     * 获取图形验证码
     * @RequestMapping(path="getQrcodeImg", methods="post,get")
     */
    public function getQrcodeImg(RequestInterface $request)
    {
        return $this->verifyImgService->getQrcodeImg((string)$request->input('key'));
    }
}